/**
 * 异步获取元素，直到获取成功
 * @param selector
 * @param timeOut
 * @returns {Promise<>}
 */
const getElement = (selector, timeOut = 500) => {
    return new Promise(resolve => {
        const i1 = setInterval(() => {
            const el = document.querySelector(selector);
            if (el === null) return;
            clearInterval(i1);
            resolve(el);
        }, timeOut);
    });
}
//获取合集列表元素
const getDefVideoPlayPageListEl = () => {
    return getElement(".video-pod__body");
}

//获取稍后再看视频页右侧播放合集网页元素
const getCheckBackLaterVideoListElements = async () => {
    const p1 = getElement("#playlist-video-action-list-body");
    const p2 = getElement("#playlist-video-action-list");
    const defList = await Promise.all([p1, p2]);
    [bodyListEl, listEl] = defList;
    return {bodyList: bodyListEl, listEl: listEl, defList: defList}
}
